import { createApp } from 'vue'
import { createPinia } from 'pinia'//引入Pinia
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'//引入Pinia保存localStorage插件
import App from './App.vue'
import router from './router'
import '@/assets/index.css'//引入自定义样式
import ElementPlus from 'element-plus'//引入ElementPlus组件
import 'element-plus/dist/index.css'//引入ElementPlus样式图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'//引入ElementPlus图标
import zhCn from 'element-plus/dist/locale/zh-cn'//引入中文语言包

const app = createApp(App)
// 注册所有Element Plus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(router) //全局引入路由(路由必须在ElementPlus前使用，放在后面会得不到路由)
const pinia = createPinia() //创建pinia
pinia.use(piniaPluginPersistedstate)//pinia使用piniaPluginPersistedstate插件
app.use(pinia) //全局引入pinia
//全局引入ElementPlus
app.use(ElementPlus, {
  locale: zhCn, // 设置为中文
}) 

app.mount('#app')